package demo;

import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */
public class Training {
    public static Scanner scanner = new Scanner(System.in);
    public static void main1(String[] args) {
        //Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            long ret = fun1();
            System.out.println(ret);
        }
        scanner.close();
    }

    private static long fun1() {
        int n = scanner.nextInt();
        int sum = 0;
        int count = 0;
        int count2 = 0;
        int[] nums = new int[n+1];
        for (int i = 1; i <= n; i++) {
            nums[i] = scanner.nextInt()%2;
            sum += nums[i];
            if(nums[i]==0) {
                count++;
            }else {
                count2++;
            }
        }
//		int sum2 = 0;
//		for (int i = count2-1; i >= 1; i--) {
//			sum2 += i;
//		}
        if(sum%2==1) {
            return 0;
        }
        long ret = (long)Math.pow(2, count)*(long)Math.pow(2, count2>0?count2-1:0);
        return (long)(ret%1000000007l);
    }

    //数组分割
    public static void main2(String[] args) {
        int n = scanner.nextInt();
        int count0 = 0;
        int count1 = 0;
        int val = 0;
        for (int i = 0; i < n; i++) {
            int len = scanner.nextInt();
            count0 = 0;
            count1 = 0;
            for (int j = 0; j < len; j++) {
                val = scanner.nextInt()%2;
                val = val==1?count1++:count0++;
            }
            if(count1%2==1) {
                System.out.println(0);
                continue;
            }
            int ret = (int)(Math.pow(2, count0)*Math.pow(2, count1>0?count1-1:0)%1000000007);
            System.out.println(ret);
        }
    }

    //阶乘求和
    public static void main3(String[] args) {
        long sum = 0;
        for (int i = 1; i <= 47; i++) {
            sum += fun2(i);
        }
        System.out.println(sum);
        System.out.println(fun(15));
    }

    private static long fun2(int n) {
        long sum = 1;
        while(n!=1) {
            sum *= n;
            sum %= 1000000000l;
            n--;
        }
        return sum;
    }


    //山
    public static void main(String[] args) {
        int count = 0;
        for (int i = 2022; i <= 2022222022; i++) {
            if(fun(i)) {
                count++;
                System.out.println(i);
            }
        }
        System.out.println(count);
    }

    private static boolean fun(int n) {
        String str = String.valueOf(n);
        int len = str.length();
        int left = 0;
        int right = len-1;
        int val = 0;
        while(left<right) {
            if(left>0) {
                if(val>Integer.valueOf(str.charAt(left))) {
                    return false;
                }
            }
            val = Integer.valueOf(str.charAt(left));
            if(str.charAt(left++) != str.charAt(right--)) {
                return false;
            }
        }
        if(len%2==1) {
            if(Integer.valueOf(str.charAt(len/2)) < Integer.valueOf(str.charAt(len/2-1))) {
                return false;
            }
        }
        return true;
    }
}
